package com.songtech.demo.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.songtech.demo.dao.DemoDao;
import com.songtech.demo.dao.DemoMapper;
import com.songtech.demo.model.Demo;

@Service
public class DemoService {
	@Resource(name = "com.songtech.demo.dao.impl.DemoDaoImpl")
	private DemoDao<Demo> demoDao; 
	
	@Autowired
	private DemoMapper userMapper;

	@Cacheable(value="getById")
	public List<Demo> getAll(){
		System.out.println("无缓存的时候调用这里"); 
		return userMapper.getAll();
	}
	
	@Cacheable(value="getById")
	public Demo getOne(Long id){
		System.out.println("无缓存的时候调用这里"); 
		return userMapper.getOne(id);
	}
	
	public List<Demo> getAllDemo() {
		return demoDao.getAllDemo();
	}

}
